#include <stdio.h>
// #include "liqueue.h"
// #include "liqueue.cpp"
#include "sqqueue.cpp"
#include "sqqueue.h"
void dispQueue(SqQueue *&q);
int main()
{
    /************Begin*************/

    int N = 10;
    int M = 3;

    SqQueue *q;
    InitQueue(q);

    for(int i = 1;i <= N;i++){
        enQueue(q,i);
    }
    dispQueue(q);

    int flag = 0;
    int order = 0;
    while (!QueueEmpty(q)) {
        for (int i = 1; i < M; i++) {
            if (!deQueue(q, order)) {
                order = q->data[q->rear];
                q->rear = (q->rear + 1) % MaxSize;
                enQueue(q, order);
                break;
            }
            enQueue(q, order);
        }
        if (deQueue(q, order)) {
            printf("%d ", order);
        }
    }
    /************End*************/

    return 0;
}





void dispQueue(SqQueue *&q)
{
    int m ,n;
    m = q->front%MaxSize;
    n = q->rear%MaxSize;
   for(int i = m;i<n;i++){
       printf("%d ",q->data[i+1]);
   }
   printf("\n");
}